package cn.enilu.flash.bean.entity.shop;

import cn.enilu.flash.bean.entity.ShopBaseEntity;
import cn.enilu.flash.bean.entity.system.Express;
import cn.enilu.flash.bean.enumeration.shop.OrderEnum;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Table;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Data
@Table(appliesTo = "t_shop_order_refund",comment = "订单退款历史")
@Entity(name="t_shop_order_refund")
@SQLDelete(sql = "update t_shop_order_refund e set e.disable=1 where e.id = ?")
@Where(clause = "disable=0")
public class OrderRefund extends ShopBaseEntity {

    @Column(name="id_order",columnDefinition = "BIGINT COMMENT '订单ID'")
    private Long orderId;
    @Column(columnDefinition = "VARCHAR(32) COMMENT '订单号'")
    private String orderSn;

    @Column(columnDefinition = "INT COMMENT '支付状态1:未付款;2:已付款,3:支付中'")
    private Integer payStatus;
    @Column(columnDefinition = "VARCHAR(32) COMMENT '支付流水号'")
    private String payId;
    @Column(columnDefinition = "VARCHAR(32) COMMENT '支付成功时间'")
    private Date payTime;

    public String getPayStatusName(){
        if(payStatus!=null) {
            return OrderEnum.getPayStatus(payStatus).getValue();
        }
        return null;
    }

}
